﻿using System;
using System.Linq;

class Program
{
    static void Main()
    {
        int[] array = { 1, 2, 3, 4, 5 };
        int maxnumber = array.Max();
        int minnumber = array.Min();
        double averagenumber = array.Average();
        int sum = array.Sum();
        Console.WriteLine(maxnumber);
        Console.WriteLine(minnumber);
        Console.WriteLine(averagenumber);
        Console.WriteLine(sum);

        // 测试
        Square square = new Square();
        float squareSide = 5;
        float squareArea = square.CalculateArea(squareSide);
        Console.WriteLine($"Square with side length {squareSide} has area: {squareArea}");
        bool isSquare = square.CheckSquare(5, 5, 5, 5);
        Console.WriteLine($"Is it a square? {isSquare}");
        
        Rectangle rectangle = new Rectangle();
        float rectLength = 4, rectWidth = 6;
        float rectArea = rectangle.CalculateArea(rectLength, rectWidth);
        Console.WriteLine($"Rectangle with length {rectLength} and width {rectWidth} has area: {rectArea}");
        bool isRectangle = rectangle.CheckRectangle(4, 6, 4, 6);
        Console.WriteLine($"Is it a rectangle? {isRectangle}");
        
    
        Triangle triangle = new Triangle();
        float triBase = 3, triHeight = 4;
        float triArea = triangle.CalculateArea(triBase, triHeight);
        Console.WriteLine($"Triangle with base {triBase} and height {triHeight} has area: {triArea}");
        bool isTriangle = triangle.CheckTriangle(3, 4, 5);
        Console.WriteLine($"Is it a triangle? {isTriangle}");
        
        
    }
}

class Square
{
    public float Area = 0;
    public float Side_Length = 0;

    public float CalculateArea(float x)
    {
        Area = x * x;
        return x * x;
    }

    public bool CheckSquare(float a, float b, float c, float d)
    {
        if (a == b && b == c && c == d)
        {
            return true;
        }
        else return false;
    }
}
class Rectangle
{
    public float Area=0;
    public float Rclength=0,Rcwidth=0;
    public float CalculateArea(float x,float y)
    {
        Area=x*y;
        return x * y;
    }

    public bool CheckRectangle(float a, float b, float c, float d)
    {
        if ((a==b&&c==d) ||(a==c&&b==d)||(a==d&&c==b))
        {
            return true;
        }
        else return false;
    }
}

class Triangle
{
    public float Area=0;
    public float Trilengtha=0,Trilengthb=0,Trilengthc=0;
    public float CalculateArea(float x,float y)
    {
        Area=x*y/2;
        return x * y/2;
    }

    public bool CheckTriangle(float a, float b, float c)
    {
        if (a+b>c&&a+c>b&&b+c>a)
        {
            return true;
        }
        else return false;
    }
}


